#include<stdio.h>
int main()
{
    //freopen("in.txt","r",stdin);
    float ans = 0;
    int n,m;
    scanf("%d %d",&n,&m);
    for(int i = 0; i<n;i++)
    {
        int max = 0;
        int min = 10;
        int sum = 0;
        for(int j = 0; j<m;j++)
        {
            int k;
            scanf("%d",&k);
            if(min > k) min = k;
            if(max < k) max = k;
            sum +=k;
            //printf("%d ",k);
        }
        //printf("%d %d %d\n",sum,min,max);
        sum = sum-min-max;
        float z = sum/((m-2)*1.0);
        if(ans < z) ans = z;
    }
    printf("%.2f",ans);
}